package com.nine.shop.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor //无参构造器
@AllArgsConstructor//全参构造器
@TableName("db_goods")
public class Goods {
    @TableId
    private  Integer id;
    private  String title;//标题
    private  Integer typeId;
    private  double price;//价格
    private  String description;//详细信息
    private Date createDate;
    private  int status;//状态 0：未删除 1：已删除
    private  int count;//库存

    @TableField(exist = false)
    private String statusStr;//类别
    @TableField(exist = false)
    private List<Image> imageList;//图片集合
    @TableField(exist = false)
    private Type type;//类别
    @TableField(exist = false)
    private String tn;//类别名称


    public String getStatusStr() {
        return status==0?"上架":"下架";
    }
}
